/*  Search - semi-case insensative searching/
**  $VER: Search V1_0 05-25-95
**  by Brian Gragg
**
**  To use, highlight any columns you want to search and then run this macro.
**  Remember you can select non-continguous rows by holding the CTRL key down.
**  The macro will convert the text string you indicate to all UPPER case, all
**  lower case and with the first letter Upper case and search for any of these.
**  If you want to search for other mixed case stuff, use the Query menu item
**  just remember that it is case sensative :(
**
*/

OPTIONS RESULTS

'RequestText "Case Insensative Search" "Search for what text?" '
searchtext = RESULT

IF searchtext="RESULT" THEN EXIT

text1 = UPPER(searchtext)
text2 = TRANSLATE(searchtext,XRANGE('a','z'),XRANGE('A','Z'))
text3 = LEFT(text1,1) || SUBSTR(text2,2)

NumColumns
columns = RESULT

string = ""
DO c=1 TO columns
	IsColumnSelected c
	IF RESULT = 1 THEN DO
		IF LENGTH(string)>0 then string = string || " OR "

		GetColumnName POSITION c
		name = RESULT
		string = string || 'Contains('name',"'text1'") OR Contains('name',"'text2'") OR Contains('name',"'text3'")'
	END
END

IF string="" THEN 'ShowMessage 1 1 "Columns must be selected first" "" "" "Okay" "" ""'

'Query 'string
